import { Login, LoginParam } from '../../types/jobs/login';
import fetch, { BaseResponse } from '../index';
/**
 * 获取用户信息
 * @returns Login
 */
export async function getCurrentUser(): Promise<BaseResponse<Login>> {
  const { data } = await fetch.post<BaseResponse<Login>>('/xuefu/oaphone/teacher/info', {});
  return data;
}

/**
 * 登录
 * @param  LoginParam
 * @returns Login
 */
export async function userLogin(param: LoginParam): Promise<BaseResponse<Login>> {
  const { data } = await fetch.get<BaseResponse<Login>>('/xuefu/oaphone/teacher/login', { ...param });
  return data;
}

/**
 * 注册
 * @param  LoginParam
 * @returns Login
 */
export async function register(param: LoginParam): Promise<BaseResponse<Login>> {
  const { data } = await fetch.get<BaseResponse<Login>>('/xuefu/oaphone/teacher/register', {...param});
  return data;
}
